package com.longge;

public class MaxProduct {

    public int maxProduct(int[] nums) {

        int index = 0, max = 0;
        for (int i = 0; i < nums.length; i++) {
            if (max < nums[i]) {
                index = i;
                max = nums[i];
            }
        }
        nums[index] = 0;
        int secondMax = 0;
        for (int num : nums) {
            secondMax = Math.max(secondMax, num);
        }
        return (max + 1) * (secondMax + 1);

    }
}
